﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Aga.Controls.Tree;
using System.IO;
using System.Reflection;
using UnrealDebugger.Controls;

namespace UnrealDebugger.Panels
{
    public partial class OutlinePanel : Panel
    {
        private OutlineControl _outlineControl = new OutlineControl();

        public OutlinePanel()
        {
            InitializeComponent();
            this.Controls.Add(_outlineControl);
            UnrealDebuggerIDE.Instance.OnDocumentClosed += new UnrealDebuggerIDE.DocumentClosedDelegate(OnDocumentClosed);
            UnrealDebuggerIDE.Instance.OnDocumentActivated += new UnrealDebuggerIDE.DocumentActivatedDelegate(OnDocumentActivated);
        }

        void OnDocumentClosed(Document document)
        {
            this.SuspendLayout();
            this.Controls.Remove(_outlineControl);
            _outlineControl = new OutlineControl();
            this.Controls.Add(_outlineControl);
            this.ResumeLayout();
        }

        void OnDocumentActivated(Document document)
        {
            this.SuspendLayout();
            this.Controls.Remove(_outlineControl);
            _outlineControl = document.OutlineControl;
            this.Controls.Add(_outlineControl);
            this.ResumeLayout();
        }
    }
}
